<?php

//Default
class Form_Data_Import extends Base_Form
{
    public function init()
    {
        // Set the method for the display form to POST
        $this->setMethod('post');
		
		$this->addElements(array(
			//
            new Zend_Form_Element_Hash('csrf', array(
				'ignore'   => true,
				'Decorators' =>array(
					'ViewHelper'
				),
            )),
			//
            new Zend_Form_Element_File('datafile', array(
                'required'   => true,
                'label'		=> 'Data file:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'StringLength', 'options' => array(5,16))
                )
            )),
			// Add an submit element
            new Zend_Form_Element_Submit('submit', array(
                'label'      => 'Submit',
				'ignore'   => true,
				'Decorators' =>array(
					'ViewHelper',
					'Description'
				)
            )),
			// Add an submit element
            new Zend_Form_Element_Reset('reset', array(
                'label'      => 'Reset',
				'ignore'   => true,
				'Decorators' =>array(
					'ViewHelper'
				),
            )),
			// Add an submit element
            new Zend_Form_Element_Button('back', array(
                'label'      => 'Back',
				'ignore'   => true,
				'Decorators' =>array(
					'ViewHelper'
				),
            )),
        ));

        $this->addDisplayGroups(array(
			array(
				'name' => 'import',
				'options' => array(
					'legend' => 'Import'
				),
				'elements' => array(
					'name',
				),
			),
			array(
				'name' => 'button',
				'elements' => array(
					'submit', 'reset',  'back'
				),
				'options' => array(
					'decorators'=> array('FormElements', array('HtmlTag', array('tag' => 'p')))
				)
			),
		));
    }
}
